package com.loop.bigNum;

import java.math.BigDecimal;

/**
 * 精准的浮点类型
 */
public class BIgDecimalDemo {
    public static void main(String[] args) {
        double d1 = 0.65;
        double d2 = 0.60;
        System.out.println(d1-d2);
        BigDecimal bigDecimal1 = new BigDecimal("0.65");
        BigDecimal bigDecimal2 = new BigDecimal("0.6");
        System.out.println(bigDecimal1.subtract(bigDecimal2));
        System.out.println(bigDecimal1.add(bigDecimal2));
        System.out.println(bigDecimal1.divide(bigDecimal2,4,BigDecimal.ROUND_HALF_UP));
        System.out.println(bigDecimal1.multiply(bigDecimal2));

    }
}
